{% extends "master.html" %}
{% block subtitle %} - 主面板  - 出入库管理{% endblock %}


{% block main %}
<div class="container">
    <div class="row">
        <ul class="breadcrumb">
          <li><a href="{{url_for('bpRoot.view')}}">主面板</a> <span class="divider">\</span></li>
          <li class="active">出入库管理</li>
        </ul>
    </div>
    <div class="row">
        {{mymacros.render_search_form(form,3)}}
    </div>
    <div class="row">
        <div class="btn-toolbar pull-right">
            <div class="btn-group"><button type="button" class="btn btn-primary" onclick="$('form').submit()">查询记录</button></div>
            {% if getAllPermission(['SUPER_USER',]) %}
                <div class="btn-group"><a href="{{url_for('bpIvtnt.view',action='add',t=IVTNT_IN)}}" class="btn btn-primary">创建入库单</a></div>
                <div class="btn-group"><a href="{{url_for('bpIvtnt.view',action='add',t=IVTNT_OUT)}}" class="btn btn-primary">创建出库单</a></div>
            {% endif %}
        </div>
    </div>
    
    
    <div class="row">
        <table class="table table-bordered">
            <thead>
                <tr>
                    <td class="span3">系统编号</td>
                    <td class="span2">行为 - 出/入库</td>
                    <td>涉及</td>
                    <td class="span1">状态</td>
                    <td class="span2">经办人</td>
                    <td class="span2">开单时间</td>
                    <td class="span2">收/发货时间</td>
                </tr>
            </thead>
            <tbody>
                {% for r in result.items %}
                    <tr>
                        <td><a href="{{url_for('bpIvtnt.view',action='view',id=r.id)}}">{{r.no}}</a></td>
                        <td>{{guessNotp(r.refer)}} - {{r.direction|ss(c='IVTNT')}}</td>
                        <td>{{ mymacros.render_goto_popup(r.refer, loop.first) }}</td>
                        <td>
                            {% if r.status == IVTNT_APPROVE %}
                                <span style="color: green;">
                            {% elif r.status == IVTNT_NEW %}
                                <span>
                            {% else %}
                                <span style="color: red;">
                            {% endif %}
                            {{r.status|ss(c='IVTNT')}}
                            </span>
                        </td>
                        <td>{{r.createBy}}</td>
                        <td>{{r.createTime|fd}}</td>
                        <td>{{r.appTime|ft}}</td>
                    </tr>
                {% endfor %}
            </tbody>                
        </table>
        {{mymacros.mypaginate(result)}}
    </div>
</div>
{% endblock %}